<template>
    <div class ="home-new">
        <div class="title">
            <h3>全新新品上市</h3>
        </div>
        <ul>
            <li v-for="item in newList" :key="item.id">
                <img :src="item.pic_url" />
                <p>{{ item.name }}</p>
                <p><span>￥{{ item.retail_price }}</span></p>
            </li>
        </ul>
    </div>
</template>

<script setup>
    const newList = [
        { id: 1, name: '懒人沙发可躺可睡 卧室单人小沙发',pic_url:'/images/new1.jpg', retail_price: 105.8},
        { id: 2, name: '准者篮球波浪纹比赛专用 正品户外野球7号',pic_url:'/images/new2.jpg', retail_price: 49.9},
        { id: 3, name: '克莱因蓝星星发夹 边夹侧边刘海夹',pic_url:'/images/new3.jpg', retail_price: 7.5},
        { id: 4, name: '卫龙魔芋爽素毛肚辣条解馋小零食',pic_url:'/images/new4.jpg', retail_price: 14.9},
    ]

</script>

<style lang="scss" scoped>
    .home-new {
        margin-top: 0.5em;
        // 标题
        .title{
            text-align: center;
            font-size: 16px;
            height: 25px;

            h3 {
                width: 50%;
                border-top: 2px solid #ccc;
                padding-top: 6px;
                margin: 0 auto;
            }
        }
    }

    //商品列表
    ul {
        display: flex;
        justify-content:space-between;
        flex-wrap:wrap;
        padding: 1em 0 0;
        li {
            margin-top: 2px;
            width: 49.5%;
            background-color: rgb(245, 245, 245);
            img{
                width: 100%;
            }
            //图片下文本
            p {
                text-align: center;
                margin: 0 auto;
            }
            // 价格
            span {
                color: red;
                font-size: 18px;
                margin-right: 0;
            }
        }
    }
</style>